﻿/**	@file		lolix_cfg.h
 *	@date		(2007-02-01 02:16:36)/(2014-01-19 20:54:47)
 *-----------------------------------------------------------------------------
 *	\brief		LoliX.lib 的初始化配置文件.
 *	@version	1.0.33.44
 *	@author		Nick Shallery	(nicknide@gmail.com)
 *	@copyright	YOU HAVE ALL LEFT WITH THIS CODE WHILE YOU KEEP COMMENT IN EVERY COPY.
 *-----------------------------------------------------------------------------
**/


#if			!defined(__LOLIX__LOLI_X_CFG__K_IN_G__)
#define		__LOLIX__LOLI_X_CFG__K_IN_G__
//==============================================================================
//--------------------------------------------------------------------------

//	如果不希望在win32平台下使用注册表搜索资源的话，就把这个开关打开
//#define	LOLIX_OPTION_DISABLE_SEARCH_LIB_FROM_REG

#define		LOLIX_CFG__CFG_TYPE_DEBUG	0
#define		LOLIX_CFG__CFG_TYPE_PROFILE	1
#define		LOLIX_CFG__CFG_TYPE_RELEASE	2

#if			defined(_DEBUG) || defined(DEBUG)
	#define		LOLIX_CFG__IS_DEBUG			1
	#define		LOLIX_CFG__IS_NOT_DEBUG		0
	#define		LOLIX_CFG__IS_PROFILE		0
	#define		LOLIX_CFG__IS_NOT_PROFILE	1
	#define		LOLIX_CFG__IS_RELEASE		0
	#define		LOLIX_CFG__IS_NOT_RELEASE	1
	#define		LOLIX_CFG__LIB_MODEL_STRING	"d"
	#define		LOLIX_CFG__CFG_TYPE			LOLIX_CFG__CFG_TYPE_DEBUG
#elif		!defined(NDEBUG)
	#define		LOLIX_CFG__IS_DEBUG			0
	#define		LOLIX_CFG__IS_NOT_DEBUG		1
	#define		LOLIX_CFG__IS_PROFILE		1
	#define		LOLIX_CFG__IS_NOT_PROFILE	0
	#define		LOLIX_CFG__IS_RELEASE		0
	#define		LOLIX_CFG__IS_NOT_RELEASE	1
	#define		LOLIX_CFG__LIB_MODEL_STRING	"p"
	#define		LOLIX_CFG__CFG_TYPE			LOLIX_CFG__CFG_TYPE_PROFILE
#else
	#define		LOLIX_CFG__IS_DEBUG			0
	#define		LOLIX_CFG__IS_NOT_DEBUG		1
	#define		LOLIX_CFG__IS_PROFILE		0
	#define		LOLIX_CFG__IS_NOT_PROFILE	1
	#define		LOLIX_CFG__IS_RELEASE		1
	#define		LOLIX_CFG__IS_NOT_RELEASE	0
	#define		LOLIX_CFG__LIB_MODEL_STRING	"r"
	#define		LOLIX_CFG__CFG_TYPE			LOLIX_CFG__CFG_TYPE_RELEASE
#endif	//	defined(_DEBUG)	&& !defined(NDEBUG)

//	下面这个标记开启, 则loli_ptr 不需要对象的定义也可以定义, 但是会导致需要使用 itf_id 的地方报错: 缺少成员
#if			!defined(LOLIX_CFG__AUTO_CHECK_HAVE_ITF_ID)
	#define		LOLIX_CFG__AUTO_CHECK_HAVE_ITF_ID	1
#endif	//	!defined(LOLIX_CFG__AUTO_CHECK_HAVE_ITF_ID)

#if			!defined(LOLIX_CFG__ACTIVE_AUTO_TEST)
	#define		LOLIX_CFG__ACTIVE_AUTO_TEST	LOLIX_CFG__IS_DEBUG
#endif	//	!defined(LOLIX_CFG__ACTIVE_AUTO_TEST)

//	链接到 MS-CLIB 上去， 这个标记被设置的话， 也就是说需要 msvc*.dll 的支持了
//	默认关闭（打开的话， 需要设置动态库链接选项）
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#define		LOLIX_CFG__LINK_TO_CLIB							LOLIX_CFG__IS_DEBUG

#if			!defined(LOLIX_CFG__IS_USE_ASSERT)
	#define		LOLIX_CFG__IS_USE_ASSERT	(LOLIX_CFG__IS_DEBUG && !LOLIX_CFG__IS_RELEASE)
#endif	//	!defined(LOLIX_CFG__IS_USE_ASSERT)

#if			defined(_MSC_VER)
	#define		LOLIX_DEF__CC_TYPE_MS
	#if			!defined(LOLIX_CFG__SUPPORT_CPP_0X) && _MSC_VER >= 1600
		#define	LOLIX_CFG__SUPPORT_CPP_0X				1
	#endif	//	!defined(LOLIX_CFG__SUPPORT_CPP_0X) && _MSC_VER >= 1600
	#if			!defined(LOLIX_CFG__SUPPORT_CPP_11) && _MSC_VER >= 1800
		#define	LOLIX_CFG__SUPPORT_CPP_11				1
	#endif	//	!defined(LOLIX_CFG__SUPPORT_CPP_11) && _MSC_VER >= 1800
#elif		defined(__llvm__) || defined(__clang__)
	#define LOLIX_DEF__CC_TYPE_CLANG
	#if			__clang_major__ >= 4
		#define LOLIX_CFG__SUPPORT_CPP_0X               1
		#define LOLIX_CFG__SUPPORT_CPP_11               1
	#endif  //  __clang_major__ >= 4
#else	//	defined(_MSC_VER)
	#define		LOLIX_DEF__CC_TYPE_UNKNOW
#endif	//	defined(_MSC_VER)
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

#if			!defined(LOLIX_CFG__SUPPORT_CPP_0X)
	#define	LOLIX_CFG__SUPPORT_CPP_0X					0
#endif	//	!defined(LOLIX_CFG__SUPPORT_CPP_0X)
#if			!defined(LOLIX_CFG__SUPPORT_CPP_11)
	#define	LOLIX_CFG__SUPPORT_CPP_11					0
#endif	//	!defined(LOLIX_CFG__SUPPORT_CPP_11)

#if			defined(__cplusplus)
	#define	LOLIX_CFG__CC_SOURCE_CPP	1
#else	//	defined(__cplusplus)
	#define	LOLIX_CFG__CC_SOURCE_CPP	0
#endif	//	defined(__cplusplus)


//	当前编译器平台
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#if			defined(WIN32) || defined(WIN64) || defined(_WIN32) || defined(_WIN64)
	#define	LOLIX_CFG__PLATFORM_WINDOWS								1
	#define	LOLIX_DEF__PLATFORM_TYPE_WINDOWS
	#if			!defined(LOLIX_CFG__SIZE_TYPE_BITS_SIZE)
		#if			defined(WIN64) || defined(_WIN64)
			#define	LOLIX_CFG__SIZE_TYPE_BITS_SIZE					64
			#define	LOLIX_CFG__SIZE_TYPE_BITS_SIZE_STRING			"64"
		#else	//	defined(WIN64) || defined(_WIN64)
			#define	LOLIX_CFG__SIZE_TYPE_BITS_SIZE					32
			#define	LOLIX_CFG__SIZE_TYPE_BITS_SIZE_STRING			"32"
		#endif	//	defined(WIN64) || defined(_WIN64)
	#endif	//	!defined(LOLIX_CFG__SIZE_TYPE_BITS_SIZE)
#elif		defined(__APPLE__) && defined(__MACH__)
	#define	LOLIX_CFG__PLATFORM_WINDOWS								0
	#define	LOLIX_DEF__PLATFORM_TYPE_APPLE
	#if			defined(LOLIX_DEF__CC_TYPE_CLANG)
		#define		LOLIX_CFG__SIZE_TYPE_BITS_SIZE					__SIZE_WIDTH__
		#define		__LOLIX_TMP_DEF__EXPAND_SIZE_WIDTH_STRING__(n)	#n
		#define		__LOLIX_TMP_DEF__EXPAND_SIZE_WIDTH_STRING(n)	__LOLIX_TMP_DEF__EXPAND_SIZE_WIDTH_STRING__(n)
		#define		LOLIX_CFG__SIZE_TYPE_BITS_SIZE_STRING			__LOLIX_TMP_DEF__EXPAND_SIZE_WIDTH_STRING(__SIZE_WIDTH__)
		//#undef		__LOLIX_TMP_DEF__SIZE_STRING
	#endif	//	defined(LOLIX_DEF__CC_TYPE_CLANG)
#else
	#define	LOLIX_CFG__PLATFORM_WINDOWS								0
	#error Unknow platform.

#endif	//	defined(WIN32) || defined(WIN64) || defined(_WIN32) || defined(_WIN64)

#if			LOLIX_CFG__PLATFORM_WINDOWS && !defined(LOLIX_OPTION_DISABLE_SEARCH_LIB_FROM_REG)
	//	是否从 REG 文件中查找资源路径
	#define		LOLIX_DEF__SEARCH_LIB_FROM_REG
#endif	//	LOLIX_CFG__PLATFORM_WINDOWS && !defined(LOLIX_OPTION_DISABLE_SEARCH_LIB_FROM_REG)


#if			!defined(LOLIX_CFG__PALTFORM_UCHAR_BITS)
	#define		LOLIX_CFG__PALTFORM_UCHAR_BITS			8
#endif	//	!defined(LOLIX_CFG__PALTFORM_UCHAR_BITS)

#define	LOLIX_CFG__SIZE_TYPE_BYTE_SIZE								(LOLIX_CFG__SIZE_TYPE_BITS_SIZE/8)
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<


//	开启 alloc 的内存跟踪功能
#if			!defined(LOLIX_CFG__OPEN_MEM_ALLOC_TRACE)
	#define		LOLIX_CFG__OPEN_MEM_ALLOC_TRACE						(LOLIX_CFG__IS_DEBUG && LOLIX_CFG__LINK_TO_CLIB)
#endif	//	!defined(LOLIX_CFG__OPEN_MEM_ALLOC_TRACE)


#if			defined(LXBIN_PRJ) || defined(LOLIX_PRJ)
	#include	"../../build/compont/lxbin/fin/lolix_cfg_proj.h"
#endif	//	defined(LXBIN_PRJ) || defined(LOLIX_PRJ)


//	每个类定义的时候使用自己的配置器， 注意这个内存转移的问题
#if			!defined(LOLIX_CFG__USE_CLASS_ALLOC)
	#if			 defined(LOLIX_CFG__OPEN_PER_MEM_ALLOC_TRACE) && LOLIX_CFG__OPEN_PER_MEM_ALLOC_TRACE
		#define		LOLIX_CFG__USE_CLASS_ALLOC	1
	#else	//	 defined(LOLIX_CFG__OPEN_PER_MEM_ALLOC_TRACE) && LOLIX_CFG__OPEN_PER_MEM_ALLOC_TRACE
		#define		LOLIX_CFG__USE_CLASS_ALLOC	LOLIX_CFG__IS_DEBUG
	#endif	//	 defined(LOLIX_CFG__OPEN_PER_MEM_ALLOC_TRACE) && LOLIX_CFG__OPEN_PER_MEM_ALLOC_TRACE
#endif	//	!defined(LOLIX_CFG__USE_CLASS_ALLOC)

//	是否重定义 LOLIX_DEF__* 格式的宏为简化格式?
#if			!defined(LOLIX_CFG__REDEF_LOLIX_DEF_MACRO)
	#define		LOLIX_CFG__REDEF_LOLIX_DEF_MACRO					7
#endif	//	!defined(LOLIX_CFG__REDEF_LOLIX_DEF_MACRO)


//	允许接口抛出异常（内部使用异常功能无法通过这里屏蔽）
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#if			!defined(LOLIX_CFG__THROWS_EXCEPT)
	#define		LOLIX_CFG__THROWS_EXCEPT							0
#endif	//	!defined(LOLIX_CFG__THROWS_EXCEPT)

#if			!defined(LOLIX_CFG__STD_EXCEPT_NAME_SPACE)
	#define		LOLIX_CFG__STD_EXCEPT_NAME_SPACE(str)				::std::str
#endif	//	!defined(LOLIX_CFG__STD_EXCEPT_NAME_SPACE)
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<


//	是否使用内部的 std 替代实现	:	内部编译无关
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#define		LOLIX_CFG__USE_SELF_STD								1
//	防止内部 vector 的迭代器实现会简单就导致失效
#define		LOLIX_CFG__SELF_VECTOR_PROTECT_ITERATOR				\
				(0 && LOLIX_CFG__USE_SELF_STD)
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<



#if			!defined(LOLIX_CFG__CC_SHOW_MSG_LEVEL)
	//	0 : only error, 1 : + warning, 2 + info
	#define		LOLIX_CFG__CC_SHOW_MSG_LEVEL						2
#endif	//	!defined(LOLIX_CFG__CC_SHOW_MSG_LEVEL)

//	开启自动监测是否使用系统内部的interlock等的方式来实现引用计数
#if			!defined(LOLIX_CFG__USE_LOCK_OPT_REF_COUNTER)
	#define		LOLIX_CFG__USE_LOCK_OPT_REF_COUNTER				1
#endif	//	!defined(LOLIX_CFG__USE_LOCK_OPT_REF_COUNTER)

//	开启和关闭各类编译时警告
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//	开启废弃数据的警告
#if			!defined(LOLIX_CFG__CC_WARNING_FOR_DEPRECATED)
	#define		LOLIX_CFG__CC_WARNING_FOR_DEPRECATED				(LOLIX_CFG__CC_SHOW_MSG_LEVEL >= 1)
#endif	//	!defined(LOLIX_CFG__CC_WARNING_FOR_DEPRECATED)
//	开启非标准实现警告
#if			!defined(LOLIX_CFG__CC_WARNING_FOR_NO_STANDARD)
	#define		LOLIX_CFG__CC_WARNING_FOR_NO_STANDARD				(LOLIX_CFG__CC_SHOW_MSG_LEVEL >= 1)
#endif	//	!defined(LOLIX_CFG__CC_WARNING_FOR_NO_STANDARD)
//	开启性能警告
#if			!defined(LOLIX_CFG__CC_WARNING_FOR_PERFORMANCE)
	#define		LOLIX_CFG__CC_WARNING_FOR_PERFORMANCE				(LOLIX_CFG__CC_SHOW_MSG_LEVEL >= 1)
#endif	//	!defined(LOLIX_CFG__CC_WARNING_FOR_PERFORMANCE)
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<


//	是否开启临界区时间跟踪
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#if			!defined(LOLIX_CFG__CRITICAL_SECTION_MARK_TIME)
	#define		LOLIX_CFG__CRITICAL_SECTION_MARK_TIME			LOLIX_CFG__IS_DEBUG
#endif	//	!defined(LOLIX_CFG__CRITICAL_SECTION_MARK_TIME)
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<


#if			LOLIX_CFG__SUPPORT_CPP_11
	#define		LOLIX_DEF__ETYPE(type)	:type
#else	//	LOLIX_CFG__SUPPORT_CPP_11
	#define		LOLIX_DEF__ETYPE(type)
#endif	//	LOLIX_CFG__SUPPORT_CPP_11

//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#if			defined(__cplusplus)
namespace lolix{
#endif	//	defined(__cplusplus)
	typedef struct	_tagLoliXCfg{
		unsigned int	_flag_bits						:8;		//	标记总共占用多少位
		unsigned int	_usd_kernel_alloc				:1;		//	是否 开启了 自己的内存分配功能
		unsigned int	_is_open_mem_alloc_trace		:1;		//	是否开启了内存跟踪
		unsigned int	_is_open_mem_name_check			:1;		//	是否开启了内存名字校验
		unsigned int	_is_debug_version				:1;		//	是否是调试版本
		unsigned int	_is_cs_mark_time				:1;		//	是否开启了临界区时间跟踪
	}lolix_cfg;
#if			defined(__cplusplus)
}
#endif	//	defined(__cplusplus)
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

//--------------------------------------------------------------------------
//==============================================================================
#endif	//	!defined(__LOLIX__LOLI_X_CFG__K_IN_G__)
